home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
ada
/
gnat1792.zip
/
gnat179b
/
djgpp.faq
< prev
next >
Wrap
Text File
|
1994-06-01
|
14KB
|
264 lines
Q: What's the minimum set of .zip files I need for compiling programs?
A: djeoeXXX, djdevXXX, gccXXXbn, gasXXXbn, and bnuXXbn are required. The
remainder are for additional functionality. Note that the version
numbers do not neccessarily match between FSF programs (gas and gcc)
and my programs (go32). You'll also need bsnXXXbn for bison and
flxXXXbn for flex, where XXX is the version number.
Note that C++ requires gppXXX.zip, and ObjectiveC requires objcXXX.zip.
The C++ library includes obstacks, alloca, and regex, so you need to
get gppXXX.zip to use them (libgpl.a)
Q: I need 1.11.maint1!
A: Get and install dj111m1.zip (and dj111m2.zip, etc). These are
maintainence releases, and include updates to go32 and other programs.
They should be installed in order and after all other modules.
Q: What about documentation?
A: Get txiXXX.bn, which includes INFO.EXE. Unpack it and run "info". It
will bring up a (hopefully) self-explanatory online help system.
For go32 and programs I wrote, get djdocXXX.zip, which includes the
data files for the online help system.
For the FSF utilities, djgpp includes three files each. Example:
gcc257bn.zip - binaries & source diffs for gcc 2.5.7
gcc257dc.zip - documentation for gcc 2.5.7
gcc257sr.zip - original FSF sources for gcc 2.5.7
(Some sources are too big, and are split into multiple zips, all
of which must be unzipped to get a complete source distribution:
gcc257s1.zip
gcc257s2.zip
gcc257s3.zip
All sources are shipped in ready-to-build form. The diffs in
the diffs directory have already been applied.)
Q: How do I find out what go32 is doing?
A: The first thing to do is run "go32". It will give you gobs of
information about what it knows about your system and itself.
Next, set the "topline" flag in the GO32 environment varable
(see the README) and watch the top line of your screen. The
info there tells you something about what the program is doing.
Q: I get errors I can't figure out when I try to compile something.
A: The best way to figure out what's going wrong with gcc is to
use the "-v" switch. For example, if you run "gcc -v hello.c"
(assuming you have hello.c), it will tell you all the programs
it is running. Then, you can see which program caused the
error. The most likely cause of errors relating to missing
programs is that you haven't unpacked the zip file with
one of the compiler passes or utilities on it.
Q: Why do I get so many unresolved symbols when linking C++ programs?
A: The C++ libraries are not in libc.a, which is the only default
library. You must use a command like this:
gcc -o prog prog.o -lgpp -lm
Note that some C++ classes use math routines, so the -lm should be
given after the -lgplus. If you don't link with -lgpl or -lgpp,
you won't include any GPL code in your application. You may not
need all of these libraries for your program.
Q: How do I debug my programs?
A: First, remember to use the -g switch when you compile. This puts debugging
information into your executable. Then, to debug the program, use a
command line like this:
go32 -d edebug32 myprog
"edebug32" is the external debugger. See the file "edebug32.doc" for
information on the debugger commands. Note: if you are running in a
DPMI environment, you must use "ed32-dpmi" instead of "edebug32". Go32
normally searches relative to the current directory, then from it's own
directory, then the PATH, for the external debugger program.
Q: When I run my programs under Windows, they crash, but not outside of
Windows.
A: You may have used the "-fomit-frame-pointer" option to GCC. This
tells gcc that it can use EBP as a general register. However, the
segment used for the stack is protected against access outside of
calculated stack range, and EBP causes the stack selector to be used.
If you use this to access memory in the regular data area, you get
a protection fault. This mechanism is present to prevent you from
using so much stack that you begin corrupting data. Outside of
Windows, a different method is used to detect stack overrun, so you
don't see this fault.
Q: How do I create symbolic links?
A: Copy bin/stub.exe to the name of the link you want. In this example,
let's say the real program is dj1.exe and we want to make a link called
dj2.exe that really calls dj1.exe. We'd copy stub.exe to dj2.exe.
Next, run stubedit to modify the new programs' stub info block to change
the name of the executable it runs. In this case, we'd change it to
dj1. When you run dj2 now, it tells go32 to use the image of dj1.
C:\> copy c:\djgpp\bin\stub.exe c:\usr\bin\dj2.exe
C:\> stubedit c:/usr/bin/dj2.exe runfile=dj1
Q: When I run "gcc e:\proj\prog.c" it says "undefined escape sequence \p"?
A: Gcc is a *unix* compiler - you must use *unix* slashes (e:/proj/prog.c).
Environment variables (like GCCINC) may, however, use either, as they
are converted.
Q: I type "GCC PROG.C" and ld complains about PROG.C not being an object.
Q: I type "gcc prog.cxx" to compile a C++ program, and ld complains.
A: Gcc is *not* case insensitive like DOS is, and it uses the file's
extension to determine how to compile a file. Valid extensions are:
.cc = C++ source (passed through cpp)
.c = C source that must be passed through cpp first
.i = raw C source (no cpp pass)
.S = assembler that must be passed through cpp first
.s = raw assembler source (no cpp pass)
any other file is passed to the linker
Q: I compile my program, but can't run the output file.
A: DOS doesn't know how to run unix-style COFF files. That's what the
extender is for. To run an COFF file called myprog, type
"go32 myprog . . ."
Q: I compile my program, but when I run the .exe it hangs.
A: Most likely, you did this: "gcc foo.c -o foo.exe". This doesn't
create a real .EXE file. That's like renaming your phone directory
file to an .EXE and expecting it to run. You must use the COFF2EXE
program to convert the output of gcc to a real executable.
Q: Gcc doesn't recognize // as a comment in my C programs.
A: That's because // isn't a comment in C. If you want to compile C++,
then write C++ programs. Gcc is really two compilers in one, not
one compiler that compiles both C and C++. That's why you get
cc1 and cc1plus.
Q: I'm reading in data files, but the data gets corrupted.
A: The default file type is DOS text, even for read() and write(). You must
tell the system that a file is binary through the "b" flag in fopen(),
or O_BINARY in open() or setmode().
Q: I get "fatal signal 2" when I run gcc.
A: When gcc reports a "signal", it really means that an error occurred
trying to run the given program. The "signal" number is the DOS error
code, and 2 means "file not found". Check the COMPILER_PATH environment
variable and make sure it points to the directory with cpp.exe,
cc1.exe, etc.
Q: The binaries I get with the distribution are .exe files, but gcc creates
COFF files. I rename the COFF's to .EXE's, but they still don't work.
A: To get an .EXE from an COFF, you must *prepend* either go32.exe
or stub.exe to the file. A program called "coff2exe" is provided to
do this. Just run "coff2exe myprog".
Q: What is stub.exe?
A: Stub.exe simply calles go32.exe, and passes it information it needs to
run the COFF file attached to it. Stub is much smaller than go32, so
less disk space is used. Also, if you change go32, you don't have to
change stub, and all the stub-ized programs will use the new go32
automatically.
Q: I want to change cc1. How do I do this?
A: First, get the GNU sources. These should be the "gccXXXsr.zip"
files found in the djgpp distribution. You can also get the latest
versions from the FSF if you like. They're usually available at
prep.ai.mit.edu in /pub/gnu, if not els